﻿using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.IO;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using LibHuman;


namespace Human
{

	public class frmkhaibaocalamviec : System.Windows.Forms.Form
	{		
		private AccessData acc =new AccessData();
        Language lan = new Language();
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.Label label4;
		private System.Windows.Forms.Label label5;
		private System.Windows.Forms.Label label6;
		private System.Windows.Forms.Label label7;
        private System.Windows.Forms.Label label8;
		private System.Windows.Forms.Label label10;
		private System.Windows.Forms.ToolTip toolTip1;
		private System.Windows.Forms.Label label12;
		private System.Windows.Forms.LinkLabel linkLabel1;
		private System.Windows.Forms.TextBox txtca;
		private System.Windows.Forms.TextBox txtbatdau;
		private System.Windows.Forms.TextBox txttre;
		private System.Windows.Forms.TextBox txtketthuc;
		private System.Windows.Forms.TextBox txtbatdauvao;
		private System.Windows.Forms.TextBox txtsom;
		private System.Windows.Forms.TextBox txtbatdaura;
        private System.Windows.Forms.TextBox txtketthucvao;
		private System.Windows.Forms.TextBox txtketthucra;
		private System.Windows.Forms.CheckBox checkvao;
		private System.Windows.Forms.CheckBox checkra;
		private System.Windows.Forms.Button butthem;
		private System.Windows.Forms.Button butxoa;
		private System.Windows.Forms.Button butthoat;
		private System.Windows.Forms.Button butluu;
		private System.Windows.Forms.Button butsua;
        private System.Windows.Forms.Button butboqua;
		private System.ComponentModel.IContainer components;
        private DataSet ds = new DataSet();
		private System.Windows.Forms.ColorDialog colorDialog1;
        private Label label11;
        private ComboBox cbo_nhomcc;
        private DataGridView dgrv_danhsach;
        private Label label9;
        private TextBox txt_sogio;
        private TextBox txt_ma;
        private DataGridViewTextBoxColumn m_maca;
        private DataGridViewTextBoxColumn tenca;
        private DataGridViewTextBoxColumn batdau;
        private DataGridViewTextBoxColumn ketthuc;
        private DataGridViewTextBoxColumn gbatdau;
        private DataGridViewTextBoxColumn g_ktvao;
        private DataGridViewTextBoxColumn g_bdra;
        private DataGridViewTextBoxColumn g_ktra;
        private DataGridViewTextBoxColumn phut_vt;
        private DataGridViewTextBoxColumn phut_rs;
        private DataGridViewTextBoxColumn sogio;
        private DataGridViewTextBoxColumn nhom_cc;
        private DataGridViewTextBoxColumn ktvao;
        private DataGridViewTextBoxColumn ktra;
        private DataGridViewTextBoxColumn mau;
        private DataGridViewTextBoxColumn manhom;		
        private int flag=0;

		public frmkhaibaocalamviec()
		{
			InitializeComponent();
            lan.Read_Language_to_Xml(this.Name.ToString(), this);
            lan.Changelanguage_to_English(this.Name.ToString(), this);
		}
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
            this.components = new System.ComponentModel.Container();
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmkhaibaocalamviec));
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
            this.label1 = new System.Windows.Forms.Label();
            this.txtca = new System.Windows.Forms.TextBox();
            this.txtbatdau = new System.Windows.Forms.TextBox();
            this.label2 = new System.Windows.Forms.Label();
            this.txttre = new System.Windows.Forms.TextBox();
            this.txtketthuc = new System.Windows.Forms.TextBox();
            this.txtbatdauvao = new System.Windows.Forms.TextBox();
            this.txtsom = new System.Windows.Forms.TextBox();
            this.txtbatdaura = new System.Windows.Forms.TextBox();
            this.txtketthucvao = new System.Windows.Forms.TextBox();
            this.txtketthucra = new System.Windows.Forms.TextBox();
            this.label3 = new System.Windows.Forms.Label();
            this.label4 = new System.Windows.Forms.Label();
            this.label5 = new System.Windows.Forms.Label();
            this.label6 = new System.Windows.Forms.Label();
            this.label7 = new System.Windows.Forms.Label();
            this.label8 = new System.Windows.Forms.Label();
            this.label10 = new System.Windows.Forms.Label();
            this.butthem = new System.Windows.Forms.Button();
            this.butxoa = new System.Windows.Forms.Button();
            this.checkvao = new System.Windows.Forms.CheckBox();
            this.checkra = new System.Windows.Forms.CheckBox();
            this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
            this.butthoat = new System.Windows.Forms.Button();
            this.butluu = new System.Windows.Forms.Button();
            this.butsua = new System.Windows.Forms.Button();
            this.butboqua = new System.Windows.Forms.Button();
            this.label12 = new System.Windows.Forms.Label();
            this.linkLabel1 = new System.Windows.Forms.LinkLabel();
            this.colorDialog1 = new System.Windows.Forms.ColorDialog();
            this.label11 = new System.Windows.Forms.Label();
            this.cbo_nhomcc = new System.Windows.Forms.ComboBox();
            this.dgrv_danhsach = new System.Windows.Forms.DataGridView();
            this.label9 = new System.Windows.Forms.Label();
            this.txt_sogio = new System.Windows.Forms.TextBox();
            this.txt_ma = new System.Windows.Forms.TextBox();
            this.m_maca = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.tenca = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.batdau = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.ketthuc = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.gbatdau = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.g_ktvao = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.g_bdra = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.g_ktra = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.phut_vt = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.phut_rs = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.sogio = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.nhom_cc = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.ktvao = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.ktra = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.mau = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.manhom = new System.Windows.Forms.DataGridViewTextBoxColumn();
            ((System.ComponentModel.ISupportInitialize)(this.dgrv_danhsach)).BeginInit();
            this.SuspendLayout();
            // 
            // label1
            // 
            this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(160)))));
            this.label1.Location = new System.Drawing.Point(14, 356);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(92, 13);
            this.label1.TabIndex = 1;
            this.label1.Text = "Tên thời gian biểu";
            this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            // 
            // txtca
            // 
            this.txtca.BackColor = System.Drawing.SystemColors.HighlightText;
            this.txtca.Location = new System.Drawing.Point(112, 353);
            this.txtca.MaxLength = 20;
            this.txtca.Name = "txtca";
            this.txtca.Size = new System.Drawing.Size(80, 20);
            this.txtca.TabIndex = 1;
            this.txtca.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtca_KeyDown);
            // 
            // txtbatdau
            // 
            this.txtbatdau.BackColor = System.Drawing.SystemColors.HighlightText;
            this.txtbatdau.Location = new System.Drawing.Point(271, 353);
            this.txtbatdau.MaxLength = 5;
            this.txtbatdau.Name = "txtbatdau";
            this.txtbatdau.Size = new System.Drawing.Size(58, 20);
            this.txtbatdau.TabIndex = 2;
            this.txtbatdau.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtbatdau_KeyPress);
            this.txtbatdau.Validated += new System.EventHandler(this.txtbatdau_Validated);
            this.txtbatdau.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtbatdau_KeyDown);
            // 
            // label2
            // 
            this.label2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(160)))));
            this.label2.Location = new System.Drawing.Point(205, 356);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(63, 13);
            this.label2.TabIndex = 3;
            this.label2.Text = "Giờ bắt đầu";
            this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            // 
            // txttre
            // 
            this.txttre.BackColor = System.Drawing.SystemColors.HighlightText;
            this.txttre.Location = new System.Drawing.Point(566, 352);
            this.txttre.MaxLength = 3;
            this.txttre.Name = "txttre";
            this.txttre.Size = new System.Drawing.Size(64, 20);
            this.txttre.TabIndex = 4;
            this.txttre.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
            this.txttre.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txttre_KeyPress);
            this.txttre.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txttre_KeyDown);
            // 
            // txtketthuc
            // 
            this.txtketthuc.BackColor = System.Drawing.SystemColors.HighlightText;
            this.txtketthuc.Location = new System.Drawing.Point(424, 352);
            this.txtketthuc.MaxLength = 5;
            this.txtketthuc.Name = "txtketthuc";
            this.txtketthuc.Size = new System.Drawing.Size(58, 20);
            this.txtketthuc.TabIndex = 3;
            this.txtketthuc.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtketthuc_KeyPress);
            this.txtketthuc.Validated += new System.EventHandler(this.txtketthuc_Validated);
            this.txtketthuc.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtketthuc_KeyDown);
            // 
            // txtbatdauvao
            // 
            this.txtbatdauvao.BackColor = System.Drawing.SystemColors.HighlightText;
            this.txtbatdauvao.Location = new System.Drawing.Point(272, 378);
            this.txtbatdauvao.MaxLength = 5;
            this.txtbatdauvao.Name = "txtbatdauvao";
            this.txtbatdauvao.Size = new System.Drawing.Size(57, 20);
            this.txtbatdauvao.TabIndex = 6;
            this.txtbatdauvao.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtbatdauvao_KeyPress);
            this.txtbatdauvao.Validated += new System.EventHandler(this.txtbatdauvao_Validated);
            this.txtbatdauvao.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtbatdauvao_KeyDown);
            // 
            // txtsom
            // 
            this.txtsom.BackColor = System.Drawing.SystemColors.HighlightText;
            this.txtsom.Location = new System.Drawing.Point(112, 378);
            this.txtsom.MaxLength = 3;
            this.txtsom.Name = "txtsom";
            this.txtsom.Size = new System.Drawing.Size(80, 20);
            this.txtsom.TabIndex = 5;
            this.txtsom.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
            this.txtsom.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtsom_KeyPress);
            this.txtsom.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtsom_KeyDown);
            // 
            // txtbatdaura
            // 
            this.txtbatdaura.BackColor = System.Drawing.SystemColors.HighlightText;
            this.txtbatdaura.Location = new System.Drawing.Point(566, 377);
            this.txtbatdaura.MaxLength = 5;
            this.txtbatdaura.Name = "txtbatdaura";
            this.txtbatdaura.Size = new System.Drawing.Size(64, 20);
            this.txtbatdaura.TabIndex = 8;
            this.txtbatdaura.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtbatdaura_KeyPress);
            this.txtbatdaura.Validated += new System.EventHandler(this.txtbatdaura_Validated);
            this.txtbatdaura.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtbatdaura_KeyDown);
            // 
            // txtketthucvao
            // 
            this.txtketthucvao.BackColor = System.Drawing.SystemColors.HighlightText;
            this.txtketthucvao.Location = new System.Drawing.Point(425, 378);
            this.txtketthucvao.MaxLength = 5;
            this.txtketthucvao.Name = "txtketthucvao";
            this.txtketthucvao.Size = new System.Drawing.Size(57, 20);
            this.txtketthucvao.TabIndex = 7;
            this.txtketthucvao.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtketthucvao_KeyPress);
            this.txtketthucvao.Validated += new System.EventHandler(this.txtketthucvao_Validated);
            this.txtketthucvao.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtketthucvao_KeyDown);
            // 
            // txtketthucra
            // 
            this.txtketthucra.BackColor = System.Drawing.SystemColors.HighlightText;
            this.txtketthucra.Location = new System.Drawing.Point(112, 403);
            this.txtketthucra.MaxLength = 5;
            this.txtketthucra.Name = "txtketthucra";
            this.txtketthucra.Size = new System.Drawing.Size(80, 20);
            this.txtketthucra.TabIndex = 9;
            this.txtketthucra.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtketthucra_KeyPress);
            this.txtketthucra.Validated += new System.EventHandler(this.txtketthucra_Validated);
            this.txtketthucra.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtketthucra_KeyDown);
            // 
            // label3
            // 
            this.label3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(160)))));
            this.label3.Location = new System.Drawing.Point(494, 355);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(72, 13);
            this.label3.TabIndex = 14;
            this.label3.Text = "Đến trễ (phút)";
            this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            // 
            // label4
            // 
            this.label4.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(160)))));
            this.label4.Location = new System.Drawing.Point(356, 356);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(65, 13);
            this.label4.TabIndex = 13;
            this.label4.Text = "Giờ kết thúc";
            this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            // 
            // label5
            // 
            this.label5.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(160)))));
            this.label5.Location = new System.Drawing.Point(202, 381);
            this.label5.Name = "label5";
            this.label5.Size = new System.Drawing.Size(66, 13);
            this.label5.TabIndex = 16;
            this.label5.Text = "Bắt đầu vào";
            this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            // 
            // label6
            // 
            this.label6.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(160)))));
            this.label6.Location = new System.Drawing.Point(34, 381);
            this.label6.Name = "label6";
            this.label6.Size = new System.Drawing.Size(72, 13);
            this.label6.TabIndex = 15;
            this.label6.Text = "Về sớm (phút)";
            this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            // 
            // label7
            // 
            this.label7.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(160)))));
            this.label7.Location = new System.Drawing.Point(509, 380);
            this.label7.Name = "label7";
            this.label7.Size = new System.Drawing.Size(57, 13);
            this.label7.TabIndex = 18;
            this.label7.Text = "Bắt đầu ra";
            this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            // 
            // label8
            // 
            this.label8.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(160)))));
            this.label8.Location = new System.Drawing.Point(354, 381);
            this.label8.Name = "label8";
            this.label8.Size = new System.Drawing.Size(68, 13);
            this.label8.TabIndex = 17;
            this.label8.Text = "Kết thúc vào";
            this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            // 
            // label10
            // 
            this.label10.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(160)))));
            this.label10.Location = new System.Drawing.Point(47, 406);
            this.label10.Name = "label10";
            this.label10.Size = new System.Drawing.Size(59, 13);
            this.label10.TabIndex = 19;
            this.label10.Text = "Kết thúc ra";
            this.label10.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            // 
            // butthem
            // 
            this.butthem.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.butthem.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(160)))));
            this.butthem.Image = ((System.Drawing.Image)(resources.GetObject("butthem.Image")));
            this.butthem.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.butthem.Location = new System.Drawing.Point(110, 445);
            this.butthem.Name = "butthem";
            this.butthem.Size = new System.Drawing.Size(65, 27);
            this.butthem.TabIndex = 15;
            this.butthem.Tag = "";
            this.butthem.Text = "  &Thêm";
            this.toolTip1.SetToolTip(this.butthem, "Thêm");
            this.butthem.Click += new System.EventHandler(this.butthem_Click);
            // 
            // butxoa
            // 
            this.butxoa.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.butxoa.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(160)))));
            this.butxoa.Image = global::Human.Properties.Resources.delete_enabled;
            this.butxoa.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.butxoa.Location = new System.Drawing.Point(248, 445);
            this.butxoa.Name = "butxoa";
            this.butxoa.Size = new System.Drawing.Size(65, 27);
            this.butxoa.TabIndex = 17;
            this.butxoa.Tag = "";
            this.butxoa.Text = " &Hủy";
            this.toolTip1.SetToolTip(this.butxoa, "Xoá");
            this.butxoa.Click += new System.EventHandler(this.butxoa_Click);
            // 
            // checkvao
            // 
            this.checkvao.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.checkvao.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(160)))));
            this.checkvao.Location = new System.Drawing.Point(107, 426);
            this.checkvao.Name = "checkvao";
            this.checkvao.Size = new System.Drawing.Size(68, 17);
            this.checkvao.TabIndex = 12;
            this.checkvao.Text = "Phải vào";
            this.checkvao.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.checkvao.Visible = false;
            this.checkvao.KeyDown += new System.Windows.Forms.KeyEventHandler(this.checkvao_KeyDown);
            // 
            // checkra
            // 
            this.checkra.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.checkra.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(160)))));
            this.checkra.Location = new System.Drawing.Point(270, 426);
            this.checkra.Name = "checkra";
            this.checkra.Size = new System.Drawing.Size(59, 17);
            this.checkra.TabIndex = 13;
            this.checkra.Text = "Phải ra";
            this.checkra.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.checkra.Visible = false;
            this.checkra.KeyDown += new System.Windows.Forms.KeyEventHandler(this.checkra_KeyDown);
            // 
            // butthoat
            // 
            this.butthoat.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.butthoat.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(160)))));
            this.butthoat.Image = global::Human.Properties.Resources.close_r;
            this.butthoat.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
            this.butthoat.Location = new System.Drawing.Point(460, 445);
            this.butthoat.Name = "butthoat";
            this.butthoat.Size = new System.Drawing.Size(65, 27);
            this.butthoat.TabIndex = 20;
            this.butthoat.Text = "&Thoát";
            this.butthoat.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.toolTip1.SetToolTip(this.butthoat, "Reresh");
            this.butthoat.Click += new System.EventHandler(this.butthoat_Click);
            // 
            // butluu
            // 
            this.butluu.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.butluu.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(160)))));
            this.butluu.Image = ((System.Drawing.Image)(resources.GetObject("butluu.Image")));
            this.butluu.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.butluu.Location = new System.Drawing.Point(318, 445);
            this.butluu.Name = "butluu";
            this.butluu.Size = new System.Drawing.Size(65, 27);
            this.butluu.TabIndex = 18;
            this.butluu.Text = "&Lưu";
            this.toolTip1.SetToolTip(this.butluu, "Lưu");
            this.butluu.Click += new System.EventHandler(this.butluu_Click);
            // 
            // butsua
            // 
            this.butsua.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.butsua.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(160)))));
            this.butsua.Image = global::Human.Properties.Resources.quick_edit;
            this.butsua.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.butsua.Location = new System.Drawing.Point(179, 445);
            this.butsua.Name = "butsua";
            this.butsua.Size = new System.Drawing.Size(65, 27);
            this.butsua.TabIndex = 16;
            this.butsua.Text = "&Sửa";
            this.toolTip1.SetToolTip(this.butsua, "Sửa");
            this.butsua.Click += new System.EventHandler(this.butsua_Click);
            // 
            // butboqua
            // 
            this.butboqua.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.butboqua.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(160)))));
            this.butboqua.Image = global::Human.Properties.Resources.undo_2005;
            this.butboqua.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.butboqua.Location = new System.Drawing.Point(387, 445);
            this.butboqua.Name = "butboqua";
            this.butboqua.Size = new System.Drawing.Size(70, 27);
            this.butboqua.TabIndex = 19;
            this.butboqua.Text = "&Bỏ qua";
            this.butboqua.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.toolTip1.SetToolTip(this.butboqua, "Bỏ qua");
            this.butboqua.Click += new System.EventHandler(this.butboqua_Click);
            // 
            // label12
            // 
            this.label12.BackColor = System.Drawing.Color.Blue;
            this.label12.Location = new System.Drawing.Point(467, 423);
            this.label12.Name = "label12";
            this.label12.Size = new System.Drawing.Size(20, 20);
            this.label12.TabIndex = 14;
            this.label12.TextAlign = System.Drawing.ContentAlignment.BottomRight;
            this.label12.Visible = false;
            // 
            // linkLabel1
            // 
            this.linkLabel1.Location = new System.Drawing.Point(335, 427);
            this.linkLabel1.Name = "linkLabel1";
            this.linkLabel1.Size = new System.Drawing.Size(113, 13);
            this.linkLabel1.TabIndex = 22;
            this.linkLabel1.TabStop = true;
            this.linkLabel1.Text = "Thay đổi màu thể hiện";
            this.linkLabel1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.linkLabel1.Visible = false;
            this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked);
            // 
            // label11
            // 
            this.label11.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(160)))));
            this.label11.Location = new System.Drawing.Point(202, 406);
            this.label11.Name = "label11";
            this.label11.Size = new System.Drawing.Size(66, 13);
            this.label11.TabIndex = 16;
            this.label11.Text = "Nhóm CC";
            this.label11.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            // 
            // cbo_nhomcc
            // 
            this.cbo_nhomcc.FormattingEnabled = true;
            this.cbo_nhomcc.Location = new System.Drawing.Point(271, 403);
            this.cbo_nhomcc.Name = "cbo_nhomcc";
            this.cbo_nhomcc.Size = new System.Drawing.Size(211, 21);
            this.cbo_nhomcc.TabIndex = 10;
            // 
            // dgrv_danhsach
            // 
            dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
            dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control;
            dataGridViewCellStyle2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText;
            dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
            dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
            dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
            this.dgrv_danhsach.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
            this.dgrv_danhsach.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            this.dgrv_danhsach.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
            this.m_maca,
            this.tenca,
            this.batdau,
            this.ketthuc,
            this.gbatdau,
            this.g_ktvao,
            this.g_bdra,
            this.g_ktra,
            this.phut_vt,
            this.phut_rs,
            this.sogio,
            this.nhom_cc,
            this.ktvao,
            this.ktra,
            this.mau,
            this.manhom});
            this.dgrv_danhsach.Location = new System.Drawing.Point(3, 2);
            this.dgrv_danhsach.Name = "dgrv_danhsach";
            this.dgrv_danhsach.RowHeadersVisible = false;
            this.dgrv_danhsach.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
            this.dgrv_danhsach.Size = new System.Drawing.Size(637, 345);
            this.dgrv_danhsach.TabIndex = 38;
            this.dgrv_danhsach.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgrv_danhsach_CellContentClick);
            // 
            // label9
            // 
            this.label9.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(160)))));
            this.label9.Location = new System.Drawing.Point(509, 406);
            this.label9.Name = "label9";
            this.label9.Size = new System.Drawing.Size(57, 13);
            this.label9.TabIndex = 18;
            this.label9.Text = "Số giờ";
            this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            // 
            // txt_sogio
            // 
            this.txt_sogio.Location = new System.Drawing.Point(566, 403);
            this.txt_sogio.MaxLength = 2;
            this.txt_sogio.Name = "txt_sogio";
            this.txt_sogio.Size = new System.Drawing.Size(64, 20);
            this.txt_sogio.TabIndex = 11;
            // 
            // txt_ma
            // 
            this.txt_ma.Location = new System.Drawing.Point(531, 449);
            this.txt_ma.Name = "txt_ma";
            this.txt_ma.Size = new System.Drawing.Size(49, 20);
            this.txt_ma.TabIndex = 39;
            this.txt_ma.Visible = false;
            // 
            // m_maca
            // 
            this.m_maca.DataPropertyName = "maca";
            this.m_maca.Frozen = true;
            this.m_maca.HeaderText = "Mã";
            this.m_maca.Name = "m_maca";
            this.m_maca.Width = 40;
            // 
            // tenca
            // 
            this.tenca.DataPropertyName = "tenca";
            this.tenca.Frozen = true;
            this.tenca.HeaderText = "Tên ";
            this.tenca.Name = "tenca";
            this.tenca.Width = 80;
            // 
            // batdau
            // 
            this.batdau.DataPropertyName = "batdau";
            this.batdau.HeaderText = "Bắt đầu";
            this.batdau.Name = "batdau";
            this.batdau.Width = 50;
            // 
            // ketthuc
            // 
            this.ketthuc.DataPropertyName = "ketthuc";
            this.ketthuc.HeaderText = "Kết thúc";
            this.ketthuc.Name = "ketthuc";
            this.ketthuc.Width = 50;
            // 
            // gbatdau
            // 
            this.gbatdau.DataPropertyName = "batdauvao";
            this.gbatdau.HeaderText = "Giờ BĐ vào";
            this.gbatdau.Name = "gbatdau";
            this.gbatdau.Width = 50;
            // 
            // g_ktvao
            // 
            this.g_ktvao.DataPropertyName = "ketthucvao";
            this.g_ktvao.HeaderText = "Giờ KT vào";
            this.g_ktvao.Name = "g_ktvao";
            this.g_ktvao.Width = 50;
            // 
            // g_bdra
            // 
            this.g_bdra.DataPropertyName = "batdaura";
            this.g_bdra.HeaderText = "Giờ BĐ ra";
            this.g_bdra.Name = "g_bdra";
            this.g_bdra.Width = 50;
            // 
            // g_ktra
            // 
            this.g_ktra.DataPropertyName = "ketthucra";
            this.g_ktra.HeaderText = "Giờ KT tra";
            this.g_ktra.Name = "g_ktra";
            this.g_ktra.Width = 50;
            // 
            // phut_vt
            // 
            this.phut_vt.DataPropertyName = "sophuttre";
            this.phut_vt.HeaderText = "Phút vào trễ";
            this.phut_vt.Name = "phut_vt";
            this.phut_vt.Width = 50;
            // 
            // phut_rs
            // 
            this.phut_rs.DataPropertyName = "sophutsom";
            this.phut_rs.HeaderText = "Phút ra sớm";
            this.phut_rs.Name = "phut_rs";
            this.phut_rs.Width = 50;
            // 
            // sogio
            // 
            this.sogio.DataPropertyName = "sogio";
            this.sogio.HeaderText = "Số giờ LV";
            this.sogio.Name = "sogio";
            this.sogio.Width = 60;
            // 
            // nhom_cc
            // 
            this.nhom_cc.DataPropertyName = "tennhom";
            this.nhom_cc.HeaderText = "Nhóm CC";
            this.nhom_cc.Name = "nhom_cc";
            this.nhom_cc.Width = 80;
            // 
            // ktvao
            // 
            this.ktvao.DataPropertyName = "ktravao";
            this.ktvao.HeaderText = "kiemtravao";
            this.ktvao.Name = "ktvao";
            // 
            // ktra
            // 
            this.ktra.DataPropertyName = "ktrara";
            this.ktra.HeaderText = "kiemtrara";
            this.ktra.Name = "ktra";
            // 
            // mau
            // 
            this.mau.DataPropertyName = "mau";
            this.mau.HeaderText = "mau";
            this.mau.Name = "mau";
            // 
            // manhom
            // 
            this.manhom.DataPropertyName = "manhom";
            this.manhom.HeaderText = "Mã nhóm";
            this.manhom.Name = "manhom";
            this.manhom.Width = 50;
            // 
            // frmkhaibaocalamviec
            // 
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.ClientSize = new System.Drawing.Size(642, 473);
            this.Controls.Add(this.txt_ma);
            this.Controls.Add(this.txt_sogio);
            this.Controls.Add(this.dgrv_danhsach);
            this.Controls.Add(this.cbo_nhomcc);
            this.Controls.Add(this.txtketthuc);
            this.Controls.Add(this.linkLabel1);
            this.Controls.Add(this.label12);
            this.Controls.Add(this.butboqua);
            this.Controls.Add(this.butthoat);
            this.Controls.Add(this.butluu);
            this.Controls.Add(this.butsua);
            this.Controls.Add(this.checkra);
            this.Controls.Add(this.checkvao);
            this.Controls.Add(this.butxoa);
            this.Controls.Add(this.butthem);
            this.Controls.Add(this.label10);
            this.Controls.Add(this.label9);
            this.Controls.Add(this.label7);
            this.Controls.Add(this.label8);
            this.Controls.Add(this.label11);
            this.Controls.Add(this.label5);
            this.Controls.Add(this.label6);
            this.Controls.Add(this.label3);
            this.Controls.Add(this.label4);
            this.Controls.Add(this.label2);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.txtketthucra);
            this.Controls.Add(this.txtbatdaura);
            this.Controls.Add(this.txtketthucvao);
            this.Controls.Add(this.txtbatdauvao);
            this.Controls.Add(this.txtsom);
            this.Controls.Add(this.txttre);
            this.Controls.Add(this.txtbatdau);
            this.Controls.Add(this.txtca);
            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "frmkhaibaocalamviec";
            this.ShowInTaskbar = false;
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Text = "Khai báo lịch làm việc";
            this.Load += new System.EventHandler(this.frmkhaibaocalamviec_Load);
            ((System.ComponentModel.ISupportInitialize)(this.dgrv_danhsach)).EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();

		}
		#endregion

		private void frmkhaibaocalamviec_Load(object sender, System.EventArgs e)
		{
			Load_rong();
            load_nhomcc();
			ena_textbox(false);
			ena_button(true);
			load_datagrid();
            flag = 0;
		}
		private void Load_rong()
		{
			txtca.Text="";txtbatdau.Text="";
			txtketthuc.Text="";txtsom.Text="0";
			txttre.Text="0";txtbatdauvao.Text="";
			txtketthucvao.Text="";txtbatdaura.Text="";
            txtketthucra.Text = ""; txt_sogio.Text = "0";
			checkvao.Checked=false;checkra.Checked=false;
            txt_ma.Text="";cbo_nhomcc.SelectedIndex = -1;            
		}
        private void load_nhomcc()
        {
            cbo_nhomcc.DisplayMember = "ten";
            cbo_nhomcc.ValueMember = "ma";
            cbo_nhomcc.DataSource = acc.get_nhomcc().Tables[0];
        }
		private void ena_button(bool ena)
		{
			butthem.Enabled=ena;
            butsua.Enabled=!ena;
			butxoa.Enabled=!ena;            
			butboqua.Enabled=!ena;
            butluu.Enabled=!ena;
            butthoat.Enabled = ena;
		}
		private void ena_textbox(bool ena)
		{
			txtca.Enabled=ena;
			txtbatdau.Enabled=ena;
            txtketthuc.Enabled=ena;
			txtsom.Enabled=ena;
            txttre.Enabled=ena;
			txtbatdauvao.Enabled=ena;
            txtketthucvao.Enabled=ena;
			txtbatdaura.Enabled=ena;
            txtketthucra.Enabled=ena;
			checkvao.Enabled=ena;
            checkra.Enabled=ena;
			txt_ma.Enabled=ena;
            cbo_nhomcc.Enabled = ena;
            txt_sogio.Enabled = ena;
		}
		private void load_datagrid()
		{
            string sql = "select lv.*,cc.ten as tennhom ";
            sql += " from " + acc.user + ".lichlv lv inner join " + acc.user + ".nhom_chamcong cc on lv.manhom=cc.ma order by maca";
            dgrv_danhsach.DataSource = acc.get_data(sql).Tables[0];
		}
        private void dgrv_danhsach_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            DataRowView drv = (DataRowView)dgrv_danhsach.CurrentRow.DataBoundItem;
            txt_ma.Text=drv["maca"].ToString().Trim();
            txtca.Text = drv["tenca"].ToString().Trim();
            txtbatdau.Text = drv["batdau"].ToString().Trim();
            txtketthuc.Text = drv["ketthuc"].ToString().Trim();
            txtbatdauvao.Text = drv["batdauvao"].ToString().Trim();
            txtbatdaura.Text = drv["batdaura"].ToString().Trim();
            txtketthucvao.Text = drv["ketthucvao"].ToString().Trim();
            txtketthucra.Text = drv["ketthucra"].ToString().Trim();
            txttre.Text = drv["sophuttre"].ToString().Trim();
            txtsom.Text = drv["sophutsom"].ToString().Trim();
            txt_sogio.Text = drv["sogio"].ToString().Trim();
            checkra.Checked = drv["ktrara"].ToString().Trim() == "1";
            checkvao.Checked = drv["ktravao"].ToString().Trim() == "1";
            cbo_nhomcc.SelectedValue = drv["manhom"].ToString().Trim().Equals("") ? cbo_nhomcc.SelectedIndex = -1 : cbo_nhomcc.SelectedValue = drv["manhom"].ToString().Trim();
            ena_textbox(false);
            ena_button(false);
            butluu.Enabled = false;
            butthoat.Enabled = true;
            butsua.Focus();
        }
		private void butthem_Click(object sender, System.EventArgs e)
		{			
            ena_textbox(true);
            ena_button(false);
            butxoa.Enabled = false;
            butsua.Enabled = false;
			Load_rong();
            get_maxmaca();
            txt_ma.Text = get_maxmaca().ToString().Trim();
			txtca.Focus();
            flag = 0;
		}
        private int get_maxmaca()
        {
            int maca = 0;
            try
            {
                maca = int.Parse(acc.get_data("select max(to_number(maca)) from " + acc.user + ".lichlv").Tables[0].Rows[0][0].ToString().Trim()) + 1;
            }
            catch
            {
                maca = 1;
            }
            return maca;
        }
		private void butxoa_Click(object sender, System.EventArgs e)
		{
			string sql="";
            //sql="select * from ktvaora where maca="+maca.ToString();
            //if (acc.get_data(sql).Tables[0].Rows.Count>0)
            //{
            //    MessageBox.Show("Không thể hủy vì ca "+maca.ToString()+" đã có chấm công ","Thông báo",MessageBoxButtons.OK,MessageBoxIcon.Warning);
            //    return;
            //}

			if (MessageBox.Show(lan.Change_language_MessageText("Bạn có thật sự muốn hủy không?"),AccessData.Msg,MessageBoxButtons.YesNo,MessageBoxIcon.Question)==DialogResult.Yes)
			{
				acc.Execute_data("delete from "+acc.user+".lichlv where maca="+txt_ma.Text.Trim()+"");
                Load_rong();
			}
            flag = 0;            
            ena_textbox(false);
            ena_button(true);
		}

		private bool kiemtrahople()
		{
			if(txtca.Text.Trim()=="")
			{
				MessageBox.Show(lan.Change_language_MessageText("Tên ca làm việc!"),AccessData.Msg);
				txtca.Focus();
				return false;
			}
			if(txtbatdau.Text.Trim()=="")
			{
				MessageBox.Show(lan.Change_language_MessageText("Giờ bắt đầu phải có giá trị!"),AccessData.Msg);
				txtbatdau.Focus();
				return false;
			}
			if(txtketthuc.Text.Trim()=="")
			{
				MessageBox.Show(lan.Change_language_MessageText("Giờ kết thúc phải có giá trị!"),AccessData.Msg);
				txtketthuc.Focus();
				return false;
			}
			if(txtbatdauvao.Text.Trim()=="")
			{
				MessageBox.Show(lan.Change_language_MessageText("Giờ kết thúc phải có giá trị!"),AccessData.Msg);
				txtketthuc.Focus();
				return false;
			}
			return true;
		}

		private void butluu_Click(object sender, System.EventArgs e)
		{
			if(!kiemtrahople()) return;
			Them_1calamviec();
            ds = acc.get_data("select * from " + acc.user + ".lichlv order by maca");
            ena_textbox(false);
			ena_button(true);
            butthem.Focus();
            flag = 0;
		}

		private void butboqua_Click(object sender, System.EventArgs e)
		{
			ena_textbox(false);
			ena_button(true);
            flag = 0;
		}

		private void butsua_Click(object sender, System.EventArgs e)
		{
			ena_textbox(true);
			ena_button(false);
            butsua.Enabled = false;
            butxoa.Enabled = false;        
			txtca.Focus();
            flag = 1;
		}
		private void Them_1calamviec()
		{
            int phaivao,phaira,som,tre,maca;
            decimal sogio = 0;
			string tenca,batdau,ketthuc,batdauvao,ketthucvao,batdaura,ketthucra,mau,manhom;
			tenca =txtca.Text;
            batdau=txtbatdau.Text; 
            ketthuc=txtketthuc.Text;
			batdauvao=txtbatdauvao.Text; 
            ketthucvao=txtketthucvao.Text;
			batdaura=txtbatdaura.Text; 
            ketthucra=txtketthucra.Text;
			mau =label12.BackColor.Name.ToString().Trim();
			som =txtsom.Text.Trim()!=""?int.Parse(txtsom.Text.Trim()):0;
			tre =txttre.Text.Trim()!=""?int.Parse(txttre.Text.Trim()):0;
			phaivao=checkvao.Checked==true?1:0;	phaira=checkra.Checked==true?1:0;
            manhom =cbo_nhomcc.Text.ToString().Trim()!=""? cbo_nhomcc.SelectedValue.ToString().Trim():"";
            sogio = txt_sogio.Text.Trim() != "" ? decimal.Parse(txt_sogio.Text.Trim()) : 0;
            if (flag == 1)
            {
                maca = txt_ma.Text.Trim()!="" ?int.Parse(txt_ma.Text.Trim()):0;
            }
            else
            {
                maca = get_maxmaca();
            }
            acc.Capnhat_calamviec(maca,tenca,batdau,ketthuc,som,tre,batdauvao,ketthucvao,batdaura,ketthucra,phaivao,phaira,sogio,mau,manhom);
			ds.Clear();
            load_datagrid();
		}

		private void buttYhoat_Click(object sender, System.EventArgs e)
		{
			this.Close();
		}

		private void txtbatdau_Validated(object sender, System.EventArgs e)
		{
			if(acc.TestTime(txtbatdau)==true)
				acc.FormatTime(txtbatdau);
			else
			{
				MessageBox.Show(lan.Change_language_MessageText("Nhập lại giờ phút 4 chữ số dạng 0000"));
				txtbatdau.Focus();
			}
		}

		private void txtketthuc_Validated(object sender, System.EventArgs e)
		{
			if(acc.TestTime(txtketthuc)==true)
				acc.FormatTime(txtketthuc);
			else
			{
				MessageBox.Show(lan.Change_language_MessageText("Nhập lại giờ phút 4 chữ số dạng 0000"));
				txtketthuc.Focus();
			}
		}
		private void txtbatdauvao_Validated(object sender, System.EventArgs e)
		{
			if(acc.TestTime(txtbatdauvao)==true)
				acc.FormatTime(txtbatdauvao);
			else
			{
				MessageBox.Show(lan.Change_language_MessageText("Nhập lại giờ phút 4 chữ số dạng 0000"));
				txtbatdauvao.Focus();
			}
		}
		private void txtketthucvao_Validated(object sender, System.EventArgs e)
		{
			if(acc.TestTime(txtketthucvao)==true)
				acc.FormatTime(txtketthucvao);
			else
			{
				MessageBox.Show(lan.Change_language_MessageText("Nhập lại giờ phút 4 chữ số dạng 0000"));
				txtketthucvao.Focus();
			}
		}
		private void txtbatdaura_Validated(object sender, System.EventArgs e)
		{
			if(acc.TestTime(txtbatdaura)==true)
				acc.FormatTime(txtbatdaura);
			else
			{
				MessageBox.Show(lan.Change_language_MessageText("Nhập lại giờ phút 4 chữ số dạng 0000"));
				txtbatdaura.Focus();
			}
		}

		private void txtketthucra_Validated(object sender, System.EventArgs e)
		{
			if(acc.TestTime(txtketthucra)==true)
				acc.FormatTime(txtketthucra);
			else
			{
				MessageBox.Show(lan.Change_language_MessageText("Nhập lại giờ phút 4 chữ số dạng 0000"));
				txtketthucra.Focus();
			}
		}

		private void txtbatdau_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
		{
			if (!acc.IsNumeric(e.KeyChar.ToString()))
				e.Handled = true;
			if(e.KeyChar==8 || e.KeyChar=='.')
				e.Handled=false;
		}

		private void txtketthuc_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
		{
			if (!acc.IsNumeric(e.KeyChar.ToString()))
				e.Handled = true;
			if(e.KeyChar==8 || e.KeyChar=='.')
				e.Handled=false;
		}

		private void txttre_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
		{
			if (!acc.IsNumeric(e.KeyChar.ToString()))
				e.Handled = true;
			if(e.KeyChar==8 || e.KeyChar=='.')
				e.Handled=false;
		}

		private void txtsom_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
		{
			if (!acc.IsNumeric(e.KeyChar.ToString()))
				e.Handled = true;
			if(e.KeyChar==8 || e.KeyChar=='.')
				e.Handled=false;
		}

		private void txtbatdauvao_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
		{
			if (!acc.IsNumeric(e.KeyChar.ToString()))
				e.Handled = true;
			if(e.KeyChar==8 || e.KeyChar=='.')
				e.Handled=false;
		}

		private void txtketthucvao_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
		{
			if (!acc.IsNumeric(e.KeyChar.ToString()))
				e.Handled = true;
			if(e.KeyChar==8 || e.KeyChar=='.')
				e.Handled=false;
		}

		private void txtbatdaura_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
		{
			if (!acc.IsNumeric(e.KeyChar.ToString()))
				e.Handled = true;
			if(e.KeyChar==8 || e.KeyChar=='.')
				e.Handled=false;
		}

		private void txtketthucra_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
		{
			if (!acc.IsNumeric(e.KeyChar.ToString()))
				e.Handled = true;
			if(e.KeyChar==8 || e.KeyChar=='.')
				e.Handled=false;
		}

		private void txttinhngay_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
		{
			if (!acc.IsNumeric(e.KeyChar.ToString()))
				e.Handled = true;
			if(e.KeyChar==8 || e.KeyChar=='.')
				e.Handled=false;
		}

		private void txtca_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			if(e.KeyCode==Keys.Enter)
				SendKeys.Send("{tab}");
		}

		private void txtbatdau_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			if(e.KeyCode==Keys.Enter)
				SendKeys.Send("{tab}");
		}

		private void txtketthuc_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			if(e.KeyCode==Keys.Enter)
				SendKeys.Send("{tab}");
		}

		private void txttre_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			if(e.KeyCode==Keys.Enter)
				SendKeys.Send("{tab}");
		}

		private void txtsom_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			if(e.KeyCode==Keys.Enter)
				SendKeys.Send("{tab}");
		}

		private void txtbatdauvao_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			if(e.KeyCode==Keys.Enter)
				SendKeys.Send("{tab}");
		}

		private void txtketthucvao_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			if(e.KeyCode==Keys.Enter)
				SendKeys.Send("{tab}");
		}

		private void txtbatdaura_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			if(e.KeyCode==Keys.Enter)
				SendKeys.Send("{tab}");
		}

		private void txtketthucra_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			if(e.KeyCode==Keys.Enter)
				SendKeys.Send("{tab}");
		}

		private void txttinhngay_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			if(e.KeyCode==Keys.Enter)
				SendKeys.Send("{tab}");
		}

		private void checkvao_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			if(e.KeyCode==Keys.Enter)
				SendKeys.Send("{tab}");
		}

		private void checkra_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			if(e.KeyCode==Keys.Enter)
				SendKeys.Send("{tab}");
		}

		private void butthoat_Click(object sender, System.EventArgs e)
		{
			this.Close();
		}

		private void linkLabel1_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
		{
//			hopmau.FullOpen=true;
			ColorDialog colordg =new ColorDialog();
			if (colordg.ShowDialog() == DialogResult.OK)			
			{
				label12.BackColor=colordg.Color;
			}
		}
	}
}
